#include "MenuState.h"
#include "BackgroundImage.h"
#include "SoundWrapper.h"

MenuState::MenuState(const std::string& header)
    : menu(new Menu(header)), nextState(this)
{
}

MenuState::~MenuState()
{
}

void MenuState::init()
{
}

GraphicalElement* MenuState::createGraphics()
{
    GraphicalComposite* node = new GraphicalComposite();
    BackgroundColor* bg = new BackgroundColor(Area(0, 0, 800, 600), Color(100, 0, 0));
    addMenuLines();
    node->addChild(bg);
    node->addChild(menu);
    return node;
}

void MenuState::clearMenu()
{
    menu->clear();
}

GameState* MenuState::goToNextState(GameState* nextState)
{
    return nextState;
}

Text* MenuState::addLine(const std::string& text)
{
    return menu->addNormalLine(text);
}

Text* MenuState::addColorLine(const Color& color, const std::string& text)
{
    return menu->addColorLine(color, text);
}

Text* MenuState::addInfoText(Text* text)
{
    menu->addChild((GraphicalElement*)text);
    return text;
}

GameState* MenuState::handleEvent(const Event& event)
{
    return event.visitMenuState(this);
}

GameState* MenuState::performMenuAction1()
{
    return this;
}

GameState* MenuState::performMenuAction2()
{
    return this;
}

GameState* MenuState::performMenuAction3()
{
    return this;
}

GameState* MenuState::performMenuActionEscape()
{
    return this;
}

GameState* MenuState::performMenuActionBackspace()
{
    return this;
}

GameState* MenuState::performMenuActionReturn()
{
    return this;
}
